package org.example.entity;
import lombok.Data;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
import java.util.List;

// 商品实体
@Data
public class Product {
    private  int id;
    @NotBlank(message = "商品名称不能为空")
    private String name;

    @DecimalMin(value = "0.01", message = "价格必须大于0")
    private double price;

    @Min(value = 0, message = "库存不能为负数")
    private Integer stock;

    @DecimalMin(value = "0.01", message = "重量必须大于0")
    private double weight;

    private int status;

    @NotBlank(message = "必须选择分类")
    private Category category;

    private String specs;

    @NotBlank(message = "发货地不能为空")
    private String location;

    @DecimalMin(value = "0.00", message = "运费不能为负数")
    private double template;


    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    private String username;

    private String image;

    private int shanpinId;

}
